window.CJson = function (key_valueLength_Array,itemCount) {
    var itemCount = itemCount;
    var objectArray = [];
    var objectTemp = {};
    var index = {};
    var pos = 1;
    var createRandomString = function (length) {
        var rand = function (a,b) {
            return Math.floor(Math.random()*(b - a + 1) + a);
        };
        var str = "";
        for(var i = 0 ;i<length;i++){
            var temp = rand(0,2);
            if(temp ==0){
                str+= String.fromCharCode(rand(48,57));
            }
            else if(temp ==1){
                str+= String.fromCharCode(rand(65,90));
            }
            else{
                str+= String.fromCharCode(rand(97,122));
            }
        }
        return str;
    };
    var createObjectArray = function () {
        var a = key_valueLength_Array;
        for(var i=1;i<=itemCount;i++){
            for(var key in a){
                if(a[key]=="asc"){
                    index[key]=index[key]?index[key]+1:1;
                    objectTemp[key] = index[key];
                }
                else{
                    objectTemp[key] = createRandomString(a[key]);
                }
            }
            objectArray.push(objectTemp);
            objectTemp = {};
        }
    };
    this.getAll = function () {
      return objectArray;
    };
    this.take = function (start,end) {
        return objectArray.slice(start-1,end);
    };
    this.next = function (size) {
        var temp = objectArray.slice(pos-1,pos-1+size);
        pos+=size;
        return temp;
    };
    createObjectArray();
};